#!/bin/bash
# - block_size
# - file_size
# - test
## IOzone is a filesystem benchmark tool. The benchmark generates
## and measures a variety of file operations.

. $LKP_SRC/lib/reproduce-log.sh

args="iozone"
if [ -n "$block_size" ]; then
	args+=" -r $block_size"
	[ -n "$file_size" ] && args+=" -s $file_size"
	array=($test)
	for ele in "${array[@]}"
	do
		case $ele in
			"all")       args+=" -a"
				;;
			"write")     args+=" -i 0"
				;;
			"read")      args+=" -i 1"
				;;
			"rand_rw")   args+=" -i 2"
				;;
			"backwards") args+=" -i 3"
				;;
			"record")    args+=" -i 4"
				;;
			"stride")    args+=" -i 5"
				;;
			"fwrite")    args+=" -i 6"
				;;
			"fread")     args+=" -i 7"
				;;
			"rand_mix")  args+=" -i 8"
				;;
			"pwrite")    args+=" -i 9"
				;;
			"pread")     args+=" -i 10"
				;;
			"pwritev")   args+=" -i 11"
				;;
			"preadv")    args+=" -i 12"
				;;
			*)           echo "invalid test option, please check again!" && exit 1
				;;
		esac
	done
else
	args+=" -a"
fi

for mnt in $mount_points
do
	cmd="${args} -f $mnt/iozonetest"
	log_echo "$cmd &"
	$cmd > $TMP/iozone-$i &
	i=$((i+1))
done

log_eval wait

cat $TMP/iozone-*
